package app.r_teenus.frontend.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.RequestContextHolder;

import app.r_teenus.backend.dao.DeviceDao;
import app.r_teenus.backend.model.Device;



@Controller
public class DeviceController {

	final Logger logger = LoggerFactory.getLogger(DeviceController.class);

	static final String SEARCH_VIEW_PATH_KEY = "/deviceSearch";

	private static final String SEARCH_VIEW_KEY = "redirect:/deviceSearch.html";

	@Autowired
	protected DeviceDao deviceDao = null;

	/**
	 * <p>
	 * Deletes a employee.
	 * </p>
	 * 
	 * <p>
	 * Expected HTTP POST and request '/enterprise/delete'.
	 * </p>
	 */
	@RequestMapping(value = "/device/delete", method = RequestMethod.POST)
	public String delete(Device device) {
		deviceDao.delete(device);

		return SEARCH_VIEW_KEY;
	}
}
